var app = getApp();

Page({
  data: {},
  onLoad: function(n) {
    app.getSystem(this);
  },
  bindGetUserInfo: function(n) {
    app.getUserInfoZ(function(){
      wx.navigateBack({
        delta: 1
      })
    });
    return
    console.log(n)
    var a = app
    var o = n
    var t = getCurrentPages()
    if ("getUserInfo:ok" == n.detail.errMsg) {
      this.loginAgain()
      // wx.getUserInfo({
      //   withCredentials: !1,
      //   success: function(e) {
      //     console.log(e)
      //     return
      //     a.util.request({
      //       url: "entry/wxapp/login",
      //       cachetime: "0",
      //       data: {
      //         openid: t,
      //         img: e.userInfo.avatarUrl,
      //         name: e.userInfo.nickName
      //       },
      //       success: function(e) {
      //         console.log('zhenyi_检测到用户已经授权')
      //         console.log(e), getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data,
      //           wx.setStorageSync("userInfo", e.data), o(e.data);
      //       }
      //     });
      //   }
      // })
    } else {
      wx.showModal({
        title: "温馨提示",
        content: "您拒绝了信息授权，将无法正常使用小程序"
      });
    }
    // console.log(n), "getUserInfo:ok" == n.detail.errMsg ? wx.navigateBack({
    //     delta: 1
    // }) : wx.showModal({
    //     title: "温馨提示",
    //     content: "您拒绝了信息授权，将无法正常使用小程序"
    // });
  },
  loginAgain: function() {
    app.getUserInfoZ(function (o) {
      console.log('get userinfo')
    })
    return;
    var a = app;
    wx.login({
      success: function(e) {
        a.util.request({
          url: "entry/wxapp/Openid",
          cachetime: "0",
          data: {
            code: e.code
          },
          success: function(e) {
            console.log(e), getApp().session_key = e.data.session_key, getApp().OpenId = e.data.openid,
              getApp().getSK = e.data.session_key;
            var t = e.data.openid;
            wx.getSetting({
              success: function(e) {
                1 != e.authSetting["scope.userInfo"] ? (console.log("检测到用户没有授权"), a.util.request({
                  url: "entry/wxapp/login",
                  cachetime: "0",
                  data: {
                    openid: t,
                    img: "",
                    name: ""
                  },
                  success: function(e) {
                    getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data, wx.setStorageSync("userInfo", e.data),
                      o(e.data);
                    var t = getCurrentPages(),
                      a = t[t.length - 1],
                      n = a.route;
                  }
                })) : (console.log("检测到用户已经授权"), wx.getUserInfo({
                  withCredentials: !1,
                  success: function(e) {
                    a.util.request({
                      url: "entry/wxapp/login",
                      cachetime: "0",
                      data: {
                        openid: t,
                        img: e.userInfo.avatarUrl,
                        name: e.userInfo.nickName
                      },
                      success: function(e) {
                        console.log('zhenyi_检测到用户已经授权')
                        console.log(e)
                        getApp().getuniacid = e.data.uniacid
                        getApp().user_info = e.data
                        wx.setStorageSync("userInfo", e.data)
                        // o(e.data);
                        wx.navigateBack({
                          delta: 1
                        })
                      }
                    });
                  }
                }));
              }
            });
          }
        });
      }
    });
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {}
});